import request from '@/utils/request';

import type {
    User,
    UserInfo
} from '@/types';

export const register = (params: {
    user: User;
}): Promise<{ data: { user: UserInfo } }> =>
    request({
        method: 'POST',
        url: '/register',
        data: params.user,
    });

export const login = (params: {
    user: User;
}): Promise<{ data: { user: UserInfo } }> =>
    request({
        method: 'POST',
        url: '/login',
        data: params.user,
    });

export const getUser = (): Promise<{}> =>
    request({
        method: 'POST',
        url: '/user',
    });

export const getPermission = (): Promise<{}> =>
    request({
        method: 'POST',
        url: '/acl/permission',
    });